

class quick_sort():

    __name__="quick sort"
    __chinesename__="快速排序"

    def __init__(self,collection):
        return self.algory(collection)

    @staticmethod
    def algory(self,collection):
        length = len(collection)
        if length <= 1:
            return collection
        else:
            # Use the last element as the first pivot
            pivot = collection.pop()
            # Put elements greater than pivot in greater list
            # Put elements lesser than pivot in lesser list
            greater, lesser = [], []
            for element in collection:
                if element > pivot:
                    greater.append(element)
                else:
                    lesser.append(element)
            return  self.algory(self,lesser) + [pivot] + self.algory(self,greater)


if __name__ == '__main__':
    user_input = input('Enter numbers separated by a comma:\n').strip()
    unsorted = [ int(item) for item in user_input.split(',') ]
    print( quick_sort(unsorted) )